package comgame.scenes;

import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.audio.Music;
import com.almasb.fxgl.audio.Sound;

/**
 * Gindama On Java Now
 * 2025/7/16 13:38
 * By The Spirit Of MF DOOM
 */
// 在GameScene.java文件顶部添加MusicManager静态类
public class MusicManager {
    public static boolean isHomeMusicPlaying = false;
    public static Music homeMusic;

    public static boolean isMenuMusicPlaying = false;
    public static Music menuMusic;

    public static boolean isFishingMusicPlaying = false;
    public static Music fishingMusic;

    // 添加战斗音乐管理
    public static boolean isBattleMusicPlaying = false;
    public static Music battleMusic;

    public static void stopAll() {
        if (isHomeMusicPlaying && homeMusic != null) {
            FXGL.getAudioPlayer().stopMusic(homeMusic);
            isHomeMusicPlaying = false;
        }
        if (isMenuMusicPlaying && menuMusic != null) {
            FXGL.getAudioPlayer().stopMusic(menuMusic);
            isMenuMusicPlaying = false;
        }
        if (isFishingMusicPlaying && fishingMusic != null) {
            FXGL.getAudioPlayer().stopMusic(fishingMusic);
            isFishingMusicPlaying = false;
        }
        if (isBattleMusicPlaying && battleMusic != null) {
            FXGL.getAudioPlayer().stopMusic(battleMusic);
            isBattleMusicPlaying = false;
        }
    }

    public static void stopMenuMusic() {
        if (isMenuMusicPlaying && menuMusic != null) {
            FXGL.getAudioPlayer().stopMusic(menuMusic);
            isMenuMusicPlaying = false;
        }
    }

    // 添加停止战斗音乐的方法
    public static void stopBattleMusic() {
        if (isBattleMusicPlaying && battleMusic != null) {
            FXGL.getAudioPlayer().stopMusic(battleMusic);
            isBattleMusicPlaying = false;
        }
    }
}